/**
 * KopsoxFramework
 * Copyright (C) 2010 Free Software Foundation, Inc. <http://fsf.org/>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.kopsox.data.container;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Set;

import org.kopsox.comm.listener.Observed;
import org.kopsox.comm.message.ErrorMessage;
import org.kopsox.data.ContainerDescriptor;
import org.kopsox.data.ValidateableValue;
import org.kopsox.general.type.Typed;
import org.kopsox.general.type.ValueType;
import org.kopsox.util.persistence.Persistable;

/**
 * Standardinterface for Containers "filled" with values<br>
 * <b>Each implementing class, must have an constructor with NO arguments!</b>
 * 
 * @author Konrad Renner - 24.06.2010
 *
 */
public interface ValueContainer extends Serializable,ValidateableContainer,Typed, Observed, Persistable {

	/**
	 * Sets the value with the given valueName<br>
	 * Note: If there is no value with the name 'valueName' in the container, the value will be putted into the container<br>
	 * If there is a value with the name 'valueName' in the container, the value will not be overwritten, there will just be a change<br>
	 * of the intern value!<br>
	 * 
	 * @param valueName
	 * @param value
	 * @return List<ErrorMessage>
	 */
	@SuppressWarnings("unchecked")
	public List<ErrorMessage> setValue(final String valueName, ValidateableValue value);
	
	/**
	 * Gets the value with the given valueName
	 * 
	 * @param valueName
	 * @return ValidateableValue
	 */
	public ValidateableValue<Serializable> getValue(final String valueName);
	
	/**
	 * Gets the names of the 'dirty' values
	 * 
	 * @return Set<String>
	 */
	public Set<String> getNamesOfDirtyValues();
	
	/**
	 * Gets the number of values which are in the container
	 * 
	 * @return int
	 */
	public int getSize();
	
	/**
	 * Checks if the a value with name 'valueName' is in the ValueContainer
	 * 
	 * @param valueName
	 * @return boolean
	 */
	public boolean containsValue(final String valueName);
	
	/**
	 * Checks if the container is empty or not
	 * 
	 * @return boolean
	 */
	public boolean isEmpty();
	
	/**
	 * Gets all Values, which are in the Container
	 * 
	 * @return Collection<ValidateableValue<Serializable>>
	 */
	public Collection<ValidateableValue<Serializable>> getValues();
	
	/**
	 * Returns an Collection of the String-Representation of the Values.<br>
	 * <b>NOTE:</b> This method returns a copy of the Values in the Container, which is independent to the Container
	 * 
	 * @return Collection<String>
	 */
	public Collection<String> getValuesAsStrings();
	
	/**
	 * Gets the Descriptor for this container
	 * 
	 * @return ContainerDescriptor
	 */
	public ContainerDescriptor getDescriptor();
	
	/**
	 * Sets the Descriptor for this container
	 * 
	 * @param desc - ContainerDescriptor
	 */
	public void setDescriptor(final ContainerDescriptor desc);
	
	public ValueType getType();
}
